@extends("layouts.backend.webadmin")
@section('page-header')
    <h1>
        <small>falw\menu</small>
    </h1>
@endsection

@section('content')
    <link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/select2/css/select2.min.css">
    <link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/select2/css/select2totree.css">
    <link rel="stylesheet" href="{{env('APP_ROOT')}}/css/vulslist.css">
    <script src="{{env('APP_ROOT')}}/js/zoom.js"></script>
    <link rel="stylesheet" href="{{env('APP_ROOT')}}/css/zoom.css">
    <!-- Main content -->
    <section class="content">
        @isset($item)
        <div class="row">
            <div class="col-xs-12">
                <div class="">
                    <div class="box-body">
                        <h2 class=""><strong>{{$item->title}}</strong></h2>

                        <ul class="timeline">
                            <li>
                                <div class="timeline-badge">
                                    <a><i class="fa fa-circle" id=""></i></a>
                                </div>
                                <div class="timeline-panel">
                                    <div class="timeline-heading">
                                        <h4 class="">发布漏洞</h4>
                                    </div>
                                    <div class="timeline-body" id="abc">
                                        <p class="">漏洞编号：{{$item->vuls_number}}</p>
                                        <p class="">漏洞价值：{{$item->vlus_value}}元</p>
                                        @if(intval($item->check_id) >0)
                                            <p>检查项：{{$item->checkStr}}</p>
                                        @endif
                                        <p>创建人：@foreach($users as $user)@if( $user->id == $item->user_id)  {{ $user->real_name }} ( {{$user->name}} )  @endif @endforeach</p>
                                        <p>副标题：{{$item->description}}</p>
                                        <p>所属应用：@foreach($apps as $app) @if($app->id  == $item->app_id) {{ $app->name }} @endif @endforeach</p>
                                        <p>所属分类： @foreach($categorys as $cate) @if( $cate->id == $item->category_id) {{ $cate->name }} @endif @endforeach</p>
                                        <p>所属级别： @foreach($levels as $level)@if( $level->id == $item->level_id){{ $level->name }} @endif @endforeach</p>
                                        <p>漏洞状态： @foreach($vulstatus as $vt)@if($vt['id'] == $item->status){{$vt['name']}} @endif  @endforeach</p>
                                        <p>漏洞URL： {{$item->from_url}}</p>
                                        <p>漏洞参数： {{$item->url_parms}}</p>
                                        <p>漏洞负载： {{$item->payload}}</p>
                                        <p>内容：{!!$item->content!!}</p>
                                        <p>参考资料：</p>
                                        <div class="row">
                                            @foreach($item->ref as $ref)
                                            <div class="col-md-12">
                                                <a style="padding-left:15px;" target="_blank" href="{{route('knowledge.showpage',['id'=>$ref->id])}}">{{mb_substr($ref->title,0,50)}}</a>
                                            </div>
                                            @endforeach
                                        </div>
                                    </div>
                                    <div class="timeline-footer">
                                        <p class="text-right">{{$item->created_at}}</p>
                                    </div>
                                </div>
                            </li>
                            @foreach($vulsRecords as $ele)
                            <li>
                                <div class="timeline-badge">
                                    <a><i class="fa fa-circle invert" id=""></i></a>
                                </div>
                                {{--v1.8版本之前的没有这条记录--}}
                                @if($ele->delayed_at)
                                    <div class="timeline-panel">
                                        <div class="timeline-heading">
                                            <h4>漏洞修复延期到{{date('Y年m月d日',strtotime($ele->delayed_at))}}，延期原因如下</h4>
                                        </div>
                                        <div class="timeline-body">
                                            <p>{{$ele->content}}</p>
                                        </div>
                                        <div class="timeline-footer">
                                            <p class="text-right">{{$ele->created_at}}</p>
                                        </div>
                                    </div>
                                @else
                                <div class="timeline-panel">
                                    <div class="timeline-heading">
                                        <h4>漏洞状态由 {{$ele->uname}} ( {{$ele->account}} ) 改为@foreach($vulstatus as $vt) @if($vt['id'] == $ele->vuls_status){{$vt['name']}} @endif  @endforeach</h4>
                                    </div>
                                    <div class="timeline-body">
                                        <p>{{$ele->content}}</p>
                                    </div>
                                    <div class="timeline-footer">
                                        <p class="text-right">{{$ele->created_at}}</p>
                                    </div>
                                </div>
                                @endif
                            </li>
                            @endforeach
                            <li class="clearfix no-float"></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        @endisset
    </section>


@stop
@section('javascript-end')
    <script src="{{env('APP_ROOT')}}/assets/layui/layui.all.js"></script>
    <script src="{{env('APP_ROOT')}}/js/layertips.js"></script>
    <script>
        $(function(){
            var bodyWidth = ($('.timeline-body').outerWidth()) * 0.9;
            $('img').each(function(){
                var imgWidth = $(this).outerWidth();
                if(imgWidth > bodyWidth){
                    $(this).css({width: '90%',height: '90%'});
                }
/*                $(this).click(function(){
                    var img = $(this).attr('src');
                    var content = "<img src='"+img+"' style='border:10px #fff solid;width: 100%;height: 100%'/>";
                    var index = layer.open({
                        type: 1,
                        title: false,
                        closeBtn: 1,
                        shade: [0.6, '#000'],
                        anim: 2,
                        area: "75%",
                        skin: 'layui-layer-nobg', //没有背景色
                        shadeClose: true,
                        content: content
                    });
                    //重新给指定层设定width、top等
                    layer.style(index, {
                        textAlign:"center",
                        border:"0px dashed red"
                    });
                });*/

            });
        });
    </script>
@endsection